<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ page import="com.byedu.entity.*" %>
<% String path=request.getContextPath(); String basePath=request.getScheme()+ "://"+request.getServerName()+ ":"+request.getServerPort()+path+ "/"; %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>贝易网校</title>
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <script type="text/javascript" src="shop/js/jquery.min.js"></script>
    <script src="shop/js/jquery.js"></script>
    <script type="text/javascript">
        //点击购买按钮调用方法
        var openId = '${pOrder.openId}';
        var orderId = '${pOrder.orderId}';
        var courseId = '${pOrder.couseId}';
        var userId = '${pOrder.userId}';
        function create(){
            //调用支付接口
            $.ajax({
                url:"../topayServlet",
                type: "post",
                data: {"openId":openId,
                    "orderId":orderId,
                    "userId":userId,
                    "courseId":courseId
                },
                dataType: "json",
                success: function(json) {

                    WeixinJSBridge.invoke('getBrandWCPayRequest', {
                                "appId": json.appId,
                                "timeStamp": json.timeStamp,
                                "nonceStr": json.nonceStr,
                                "package": json.packages,
                                "signType": "MD5",
                                "paySign": json.sign
                            },
                            //调起微信支付成功
                            function(res) {
                                if (res.err_msg == "get_brand_wcpay_request:ok") {
                                    //返回商品中心
                                    alert("支付成功");
                                } else {
                                    alert("支付失败");
                                }
                                window.location.href = "http://learn.by-edu.com";
                            });
                },

                error:function(){

                }
            });
            //error=0 表示增加订单后总订单数大于10
            return false;

        }
    </script>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .head{
            line-height: 40px;
            background: #df8505;
            color: #fff;
            font-size: 20px;
            padding: 0 10px;
        }
        ul,li{
            list-style-type: none;
        }
        .box-list{
            padding: 18px;
            border: 1px solid #df8505;
        }
        .box-list li{
            line-height: 32px;
            border-top: 1px solid #a6a6a6;
            font-size:12px;
            color: #333;
        }
        .box-list li span.money{
            color: #d58512;
        }
        .btn-box{
            margin-top: 20px;
        }
        .btn-box a{
            display: block;
            width: 90%;
            line-height: 40px;
            margin: 0 auto;
            text-align: center;
            text-decoration: none;
            color: #fff;
            border-radius: 3px;
            margin-bottom: 16px;
        }
    </style>
</head>
<body>
<div>
    <h2 class="head">支付信息</h2>
    <ul class="box-list">

        <%--<li><lable>课程名称:</lable><span>${pOrder.couseName}</span></li>--%>
        <%--<li><img src="${pOrder.couseImage}" width="100%"/></li>--%>
        <%--<li><lable>订单编号:</lable><span>${pOrder.orderId}</span></li>--%>
        <%--<li><lable>订单金额:</lable><span class="money">${pOrder.orderManey}</span> 元</li>--%>
        <%--<li><lable>生效时间:</lable><span class="starttime">${pOrder.startTime}</span></li>--%>
        <%--<li><lable>失效时间:</lable><span class="endtime">${pOrder.endTime}</span></li>--%>
        <%--<li><lable>课程介绍:</lable><span>${pOrder.couseIntroduce}</span></li>--%>
        <%--<li><lable>已购买人数:</lable><span>${pOrder.attendNum}</span></li>--%>
        <%--<li><lable style="color:#ee1111">官方:</lable><span style="color:#ee1111">${pOrder.connectPeople}</span></li>--%>
        <%--<li><lable style="color:#ee1111">温馨提醒:</lable><span  style="color:#ee1111">${pOrder.connectCompany}</span> </li>--%>

        <li><lable>课程名称:</lable><span>${pOrder.couseName}</span></li>
        <li><lable>订单编号:</lable><span>${pOrder.orderId}</span></li>
        <li><lable>订单金额:</lable><span class="money">${pOrder.orderManey}</span> 元</li>
        <li><lable>生效时间:</lable><span class="starttime">${pOrder.startTime}</span></li>
        <li><lable>失效时间:</lable><span class="endtime">${pOrder.endTime}</span></li>
    </ul>
    <p class="btn-box">
        <%--<input id="btn_create" type="button" style="background: #00a65a" onclick="create()" value="微信支付" />--%>

        <a href="javascript:void(0);"id="btn_create" style="background: #00a65a" onclick="create()">微信支付</a>
        <%--<a href="" style="background: #00b3ee">支付宝支付</a>--%>
    </p>
</div>
</body>



</html>